package com.wxapp.pay.service.controller;

import com.wxapp.common.constant.pojo.vm.ResultVm;
import com.wxapp.common.constant.pojo.vo.UserVo;
import com.wxapp.common.core.annotation.User;
import com.wxapp.pay.api.pojo.pojo.vm.payConfig.PConfigVm;
import com.wxapp.pay.api.pojo.pojo.vo.payConfig.QConfigVo;
import com.wxapp.pay.service.service.PayConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lgl
 */
@RestController
@Tag(name = "支付")
@RequestMapping("pay/config")
@RequiredArgsConstructor
public class PayConfigController {
    private final PayConfigService payConfigService;


    @PostMapping("add/{id}")
    @Operation(summary ="添加支付方式参数")
    public ResultVm<String> addConfigs(@PathVariable String id, @RequestBody @Validated List<QConfigVo> qAddVo, @Schema(hidden = true) @User UserVo userVo) {
        return payConfigService.addConfigs(id,qAddVo, userVo);
    }

    @GetMapping("getDetail/{id}")
    @Operation(summary ="得到支付方式参数")
    public ResultVm<List<PConfigVm>> getConfigs(@PathVariable String id) {
        return payConfigService.getConfigs(id);
    }

}
